/************************************************************/
/*****		  Articles UnInstall Script                 *****/
/*****        =========================                 *****/
/*****                                                  *****/
/*****          Version:	1.0.0                       *****/
/*****                                                  *****/
/***** Note: To manually execute this script you must   *****/
/*****       perform a search and replace operation     *****/
/*****       for {databaseOwner} and {objectQualifier}  *****/
/*****                                                  *****/
/************************************************************/

/* Section Table */
/*****************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[FK_{objectQualifier}ArticleSection_{objectQualifier}ArticleSection]') AND type = 'F')
	ALTER TABLE {databaseOwner}[{objectQualifier}ArticleSection] DROP CONSTRAINT [FK_{objectQualifier}ArticleSection_{objectQualifier}ArticleSection]
GO

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[FK_{objectQualifier}ArticleSection_{objectQualifier}Modules]') AND type = 'F')
	ALTER TABLE {databaseOwner}[{objectQualifier}ArticleSection] DROP CONSTRAINT [FK_{objectQualifier}ArticleSection_{objectQualifier}Modules]
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticleSection]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
	DROP TABLE {databaseOwner}[{objectQualifier}ArticleSection]
GO

/* Article Table */
/*****************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[FK_{objectQualifier}Article_{objectQualifier}ArticleSection]') AND type = 'F')
	ALTER TABLE {databaseOwner}[{objectQualifier}Article] DROP CONSTRAINT [FK_{objectQualifier}Article_{objectQualifier}ArticleSection]
GO

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[FK_{objectQualifier}Article_{objectQualifier}Modules]') AND type = 'F')
	ALTER TABLE {databaseOwner}[{objectQualifier}Article] DROP CONSTRAINT [FK_{objectQualifier}Article_{objectQualifier}Modules]
GO

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}Article]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
	DROP TABLE {databaseOwner}[{objectQualifier}Article]
GO

/* CreateArticle */
/*****************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesCreateArticle]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesCreateArticle]
GO

/* DeleteArticle */
/*****************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesDeleteArticle]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesDeleteArticle]
GO

/* GetArticle */
/**************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetArticle]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesGetArticle]
GO

/* GetArticles Procedure */
/*************************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetArticles]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesGetArticles]
GO

/* GetArticlesByPage Procedure */
/*******************************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetArticlesByPage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesGetArticlesByPage]
GO

/* GetArticlesBySection Procedure */
/**********************************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetArticlesBySection]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesGetArticlesBySection]
GO

/* GetArticlesBySectionByPage Procedure */
/****************************************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetArticlesBySectionByPage]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesGetArticlesBySectionByPage]
GO

/* GetCurrentArticles Procedure */
/********************************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetCurrentArticles]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesGetCurrentArticles]
GO

/* UpdateArticle Procedure */
/***************************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesUpdateArticle]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesUpdateArticle]
GO

/* CreateSection Procedure */
/***************************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesCreateSection]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesCreateSection]
GO

/* DeleteSection Procedure */
/***************************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesDeleteSection]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesDeleteSection]
GO

/* GetSection Procedure */
/************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetSection]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesGetSection]
GO

/* GetSections Procedure */
/*************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetSections]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesGetSections]
GO

/* GetSectionsByParentSection Procedure */
/****************************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetSectionsByParentSection]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesGetSectionsByParentSection]
GO

/* UpdateSection Procedure */
/***************************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesUpdateSection]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE {databaseOwner}[{objectQualifier}ArticlesUpdateSection]
GO

/* GetNextViewOrder */
/********************/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}ArticlesGetNextViewOrder]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
	DROP FUNCTION {databaseOwner}[{objectQualifier}ArticlesGetNextViewOrder]
GO


/************************************************************/
/*****              SqlDataProvider                     *****/
/************************************************************/
